$(function(){
	var tempLength = 0;
	
	$("#search_btn").click(function() {
		$("#content").html("");
	
		var xm = $("#xm").val();
		var sfzh = $("#sfzh").val();
		var xxzz = $("#xxzz").val();
		var jgmc = $("#jgmc").val();
		var xb = $("#xb").val();
	
		var dishi = document.getElementsByName("dishi");
		if (null != dishi && dishi.length > 0) {
			tempLength = 0;
			$("#search_btn").attr("disabled", true);
			for (var i = 0; i < dishi.length; i++) {
				if (dishi[i].checked) {
					tempLength++;
					loadData(dishi[i].value, xm, sfzh, xxzz,jgmc, xb);
				}
			}
		}
	});

	function loadData(dishi, xm, sfzh, xxzz, jgmc, xb) {
		$.post(
			"GetPeopInfo?r=" + Math.random(), 
			{
				dishi : dishi,
				xm : xm,
				sfzh : sfzh,
				xxzz : xxzz,
				jgmc : jgmc,
				xb : xb
			},
			function(data) {
				tempLength--;
				if (tempLength <= 0) {
					$("#search_btn").attr("disabled", false);
				}
				$("#content").html($("#content").html() + data);
			}
		);
	}
});